package com.seu.vcampus.app;

import com.seu.vcampus.client.VCampusClient;
import com.seu.vcampus.view.ModernLoginFrame;
import javax.swing.SwingUtilities;
import javax.swing.JOptionPane;

/**
 * 虚拟校园客户端启动类
 * 
 * @author 虚拟校园开发团队
 * @since 2.0.0
 */
public class VCampusClientApplication {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            VCampusClient client = new VCampusClient("localhost", 8888);
            
            // 尝试连接到服务器
            if (!client.connect()) {
                JOptionPane.showMessageDialog(null, 
                    "无法连接到服务器，请确保服务器已启动并监听端口8888", 
                    "连接失败", 
                    JOptionPane.ERROR_MESSAGE);
                System.exit(1);
            }
            
            ModernLoginFrame loginFrame = new ModernLoginFrame(client);
            loginFrame.setVisible(true);
        });
    }
}